package com.upload.util;

import java.io.File;

import static com.upload.util.FileUtil.deleteDirectory;
import static com.upload.util.FileUtil.deleteFile;

/**
 * Created by STARF on 2017/3/22.
 */
public class DeleteFileUtil {

    public static boolean delete(String fileName) {
        File file = new File(fileName);
        if (!file.exists()) {
            System.out.println("删除文件失败:" + fileName + "不存在！");
            return false;
        } else {
            if (file.isFile())
                return deleteFile(fileName);
            else
                return deleteDirectory(fileName);
        }
    }
}
